<script setup>
defineProps({
  data: {type: Object},
})
</script>

<template>
  <div style="height: 160px" v-loading="!data.success" element-loading-text="Loading...">
    <div style="display:flex;justify-content: space-between;margin: 10px 20px;"
         v-if="data.success"
    >
      <div style="font-size: 45px">
        <i :class="`qi-${data.now.icon}-fill`"></i>
      </div>
      <div style="font-weight: bold; text-align: center;">
        <div style="font-size: 25px">{{ data.now.feelsLike }} ℃</div>
        <div style="font-size: 15px">{{ data.now.text }}</div>
      </div>
      <div style="margin-top: 18px;">
        <div style="font-size: 13px; color:grey;">{{ data.location.name }}区</div>
        <div style="font-size: 15px; margin-top: 3px;">{{ `${data.location.adm1} ${data.location.adm2}` }}</div>
      </div>
    </div>
    <el-divider style="margin: 10px 0;"/>
    <div style="display: grid; grid-template-columns: repeat(5, 1fr);text-align: center">
      <div v-for="item in data.hourly">
        <div style="font-size: 12px">{{ new Date(item.fxTime).getHours() }} 时</div>
        <div style="font-size: 18px">
          <i :class="`qi-${item.icon}`"></i>
        </div>
        <div style="font-size: 12px">
          {{ item.temp}}℃
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>

</style>